package com.llsydn.beijingnews.base;

import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.TextView;
import com.llsydn.beijingnews.R;
import com.llsydn.beijingnews.activity.MainActivity;

/**
 * @author lilinshen
 * @title 基类
 * @description 请填写相关描述
 * @date 2018/10/25 11:30
 */
public class BasePager {
    // 上下文
    public final Context context;
    // 视图，代表各个不同的页面
    public View rootview;

    public BasePager(Context context) {
        this.context = context;
        rootview = initView();
    }

    public TextView tv_title;
    public ImageButton ib_menu;
    public FrameLayout fl_content;
    public ImageButton ib_swich_list_grid;

    /**
     * 初始化公共部分视图
     *
     * @return
     */
    private View initView() {
        View view = View.inflate(context, R.layout.base_pager, null);
        tv_title = view.findViewById(R.id.tv_title);
        ib_menu = view.findViewById(R.id.ib_menu);
        fl_content = view.findViewById(R.id.fl_content);
        ib_swich_list_grid = view.findViewById(R.id.ib_swich_list_grid);
        ib_menu.setOnClickListener((v) -> {
            MainActivity mainActivity = (MainActivity) context;
            mainActivity.getSlidingMenu().toggle();
        });
        return view;
    }

    /**
     * 初始化数据
     */
    public void initData() {

    }

}
